package com.roytrack.hazelcast;

import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;

import java.util.Map;
import java.util.Queue;

public class FirstDemo {
  public static void main(String[] args) {
    HazelcastInstance instance = Hazelcast.newHazelcastInstance();
    Map<Integer, String> mapCustomers = instance.getMap("customers");
    mapCustomers.put(1, "Joe");
    mapCustomers.put(2, "Bob");
    mapCustomers.put(3, "Roy");
    System.out.println("Customer with key 1: " + mapCustomers.get(1));
    System.out.println("Map Size:" + mapCustomers.size());

    Queue<String> queueCustomers = instance.getQueue("customers");
    queueCustomers.offer("Tom");
    queueCustomers.offer("Mary");
    queueCustomers.offer("Jane");
    System.out.println("First customer: " + queueCustomers.poll());
    System.out.println("Second customer: " + queueCustomers.peek());
    System.out.println("Queue size: " + queueCustomers.size());
  }
}
